<script setup lang="ts">
import { useUserStore } from '@/store/user'

const store = useUserStore()

const handleLogin = () => {
  uni.reLaunch({
    url: '/pages/login/login',
  })
}
</script>

<template>
  <view class="auth-page">
    <slot v-if="store.token"></slot>
    <view v-else class="auth-container">
      <view class="auth-icon">
        <uni-icons type="locked" size="50" color="#16c2a3"></uni-icons>
      </view>
      <view class="auth-message">暂无访问权限，请先登录</view>
      <button class="auth-button" type="primary" @click="handleLogin">登录</button>
    </view>
  </view>
</template>

<style lang="scss">
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f5f5f5;

  .auth-container {
    text-align: center;
    padding: 60rpx;
    background-color: #fff;
    border-radius: 16rpx;
    box-shadow: 0 4rpx 24rpx rgba(0, 0, 0, 0.1);
  }

  .auth-icon {
    margin-bottom: 40rpx;
  }

  .auth-message {
    font-size: 32rpx;
    color: #666;
    margin-bottom: 40rpx;
  }

  .auth-button {
    width: 400rpx;
    height: 80rpx;
    line-height: 80rpx;
    font-size: 32rpx;
    border-radius: 40rpx;
    background-color: #16c2a3;
  }
}
</style>
